<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <%- include common %>
        <style>
            .layui-table th {
                padding: 9px 15px;
                min-height: 20px;
                line-height: 20px;
                border: 1px solid #e2e2e2;
                font-size: 14px;
                background: #f8f8f8;
            }

            .layui-table td{
                padding: 9px 15px;
                min-height: 20px;
                line-height: 20px;
                border: 1px solid #e2e2e2;
                font-size: 14px;
            }
        </style>
</head>

<body>
    <%- include("head",{title:"village"}) %>

        <table class="layui-table container">
            <thead>
                <tr>
                    <th>
                        <input type="checkbox" name="" value="">
                    </th>
                    <th>
                        房屋id
                    </th>

                    <th>
                        几栋
                    </th>
                    <th>
                       单元号
                    </th>
                    <th>
                        楼层号
                    </th>
                    <th>
                       门牌号
                    </th>
                    <th>
                       业主名称
                    </th>
                    <th>
                        联系方式
                    </th>
                    
                  
                    
                    <th>
                        操作
                    </th>
                </tr>
            </thead>
           
             <%   result.forEach((item,index)=>{  %>
                    <tr>
                    
                       
                        <td><%-index++%></td>
                        <td><%-item.id%></td>
                        <td><%-item.dong%></td>
                        <td><%-item.danyuan%></td>
                        <td><%-item.louceng%></td>
                        <td><%-item.menpai%></td>
                        <td>153</td>
                        <td>133</td>
                        <td class="td-manage" style="width: 100px;">
                        
                          
                            <button onclick="confirmdel('<%- item.id %>' )"   class="btn btn-danger"    > 删除</button>
                        </td>
                    </tr>
             <%   })  %>
            </tbody>
        </table>
      <form method="POST" action="/village/abc">
        <table class="container" style="">

            <thead>
                <tr>
                  
                    <th>
                        房屋id
                    </th>

                    <th>
                        几栋
                    </th>
                    <th>
                       单元号
                    </th>
                    <th>
                        楼层号
                    </th>
                    <th>
                       门牌号
                    </th>
                </tr>
            </thead>
            <tbody id="x-img">
                <tr>
                    <td><input type="text" name="id"></td>
                    <td><input type="text" name="dong"></td>
                    <td><input type="text" name="danyuan"></td>
                    <td><input type="text" name="louceng"></td>
                    <td><input type="text" name="menpai"></td>  
                    <td class="td-manage" style="width: 100px;">
                     <input type="submit" >
                    </td>
                </tr>
            </tbody>
        </table>
      </form>
        <%- include foot%>

</body>
    <script>
          var delId = null;

function getDelId(id){
    delId = id   // 作用域的优先级 
    console.log(delId)
}
function confirmdel(id){
            console.log(id)

            // $.ajax 
            $.ajax({
                url:"/delonecomment",
                type:"POST",
                data:{
                    id,
                },
                success(res){
                    window.location.reload()
                }
            })
        }

     
    </script>
</html>